package com.xrf;

import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;

/**
 * @project 后端程序
 * @package com.sys.common.util
 * @date /12/28
 * @modified
 */
public class MD5 {
    
    public MD5() {
    }

    public static String getMD5(String s) {
        char[] hexDigits = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
        try {
            byte[] strTemp = s.getBytes(StandardCharsets.UTF_8);
            MessageDigest mdTemp = MessageDigest.getInstance("MD5");
            mdTemp.update(strTemp);
            byte[] md = mdTemp.digest();
            int j = md.length;
            char[] str = new char[j * 2];
            int k = 0;
            for (byte byte0 : md) {
                str[k++] = hexDigits[byte0 >>> 4 & 15];
                str[k++] = hexDigits[byte0 & 15];
            }
            return new String(str);
        } catch (Exception var10) {
            return null;
        }
    }

    public static void main(String[] args) {
        System.out.println(getMD5("abc123456"));
    }
}